import request from '@/utils/request'
import Qs from 'qs'

export default {
	/* 登录 */
	login: function({loginAccount, loginPassword}){
	  return request({
	    method: 'POST',
	    url: '/sys/user/login',
	    data: Qs.stringify({
	      loginAccount: loginAccount,
	      loginPassword: loginPassword
	    })
	  })
	},
  /* 系统用户列表 */
  sysUserList: function({ pageNo, pageSize}){
    return request({
      method: 'GET',
      url: '/sys/user/userList',
      params: {
        pageNo: pageNo,
        pageSize: pageSize
      }
    })
  },
	/* 系统用户详情 */
	sysUserDetail: function(id){
	  return request({
	    method: 'GET',
	    url: '/sys/user/'+id
	  })
	},
	/* 新增系统用户 */
	addUser: function({loginAccount, loginPassword, name, phone, type, avatar, status, roleId}){
	  return request({
	    method: 'POST',
	    url: '/sys/user/addUser',
	    data: Qs.stringify({
	      loginAccount: loginAccount,
				loginPassword: loginPassword,
	      name: name,
	      phone: phone,
				type: type,
	      avatar: avatar,
				status: status,
				roleId: roleId
	    })
	  })
	},
	/* 更新系统用户 */
	updateUser: function({id, name, phone, type, avatar, status, roleId}){
	  return request({
	    method: 'POST',
	    url: '/sys/user/updateUser',
	    data: Qs.stringify({
	      id: id,
	      name: name,
	      phone: phone,
				type: type,
	      avatar: avatar,
				status: status,
				roleId: roleId
	    })
	  })
	},
	/* 系统用户菜单树 */
	sysUserMenuTree: function(id){
	  return request({
	    method: 'GET',
	    url: '/sys/user/userMenuTree/'+id
	  })
	},
}
